package main

import "fmt"

type Humaner interface {
	sayHi()
}

type Student struct {
	name string
}

type Teacher struct {
	subject string
}

func (this Student) sayHi() {
	fmt.Println(this.name)
}

func (this Teacher) sayHi() {
	fmt.Println(this.subject)
}

func sayHi(i Humaner) {
	i.sayHi()
}

func main() {
	stu := Student{"Mr"}
	tea := Teacher{"Eng"}
	sayHi(stu)
	sayHi(tea)

	x := make([]Humaner, 2)
	x[0] = stu
	x[1] = tea
	for _, i := range x {
		i.sayHi()
	}
}
